package com.hxd.otc.module.fiat_deal.bean;

import android.text.TextUtils;

import com.hxd.otc.utils.DataUtils;
import com.hxd.otc.utils.UIUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;

/**
 * 作  者 :  胡庆岭
 * 时  间 :  2018/6/12 10:42
 * 描  述 :  ${交易队bean}
 */
public class DealTeamBean implements Serializable {
    public int width = DataUtils.dp2px(UIUtils.getContext(), 105);
    public int height = DataUtils.dp2px(UIUtils.getContext(), 35);
    public int isUse;
    public double quotation;
    public String transactionPair;

    public String id;
    public String coinId;//币种ID
    public String symbol; //币种符号
    public String maxPrice; //最大单价
    public String minPrice; //最大单价
    public String minVolume; //买卖最小数量
    public String supportCurrencyCode; //支持法币
    public String[] supportCurrencyArr;  //支持法币数组
    //待用
    public String bailVolume;
    public String buyFee;
    public String buyFeeStep;
    public String createBy;
    public String createDate;
    public String dayIncPrice;
    public String disable;
    public String feeType;
    public String unknowId;
    public String pointPrice;//价格的小数位
    public String pointVolume;
    public String sellFee;
    public String sellFeeStep;
    public String updateBy;
    public String updateDate;
    public ArrayList<String> currencyCodeArr;

    private String curBuyFiat;
    private String curSellFiat;

    public ArrayList<String> getSupportCurrencyCodeArr() {
        if (currencyCodeArr == null) {
            currencyCodeArr = new ArrayList<>();
        }
        currencyCodeArr.clear();
        currencyCodeArr.addAll(Arrays.asList(supportCurrencyCode.split(",")));

        return currencyCodeArr;
    }

    public HashSet<String> getFiatsSet() {
        HashSet<String> fiats = new HashSet<>();
        if (supportCurrencyCode == null) {
            return fiats;
        }
        fiats.addAll(Arrays.asList(supportCurrencyCode.split(",")));
        return fiats;
    }

    public String getCurBuyFiat() {
        if (TextUtils.isEmpty(curBuyFiat)) {
            curBuyFiat = getSupportCurrencyCodeArr().get(0);
        }
        return curBuyFiat;
    }

    public String getCurSellFiat() {
        if (TextUtils.isEmpty(curSellFiat)) {
            curSellFiat = getSupportCurrencyCodeArr().get(0);
        }
        return curSellFiat;
    }


    @Override
    public String toString() {
        return "DealTeamBean{" +
                "width=" + width +
                ", height=" + height +
                ", isUse=" + isUse +
                ", quotation=" + quotation +
                ", transactionPair='" + transactionPair + '\'' +
                ", id='" + id + '\'' +
                ", coinId='" + coinId + '\'' +
                ", symbol='" + symbol + '\'' +
                ", maxPrice='" + maxPrice + '\'' +
                ", minPrice='" + minPrice + '\'' +
                ", minVolume='" + minVolume + '\'' +
                ", supportCurrencyCode='" + supportCurrencyCode + '\'' +
                ", supportCurrencyArr=" + Arrays.toString(supportCurrencyArr) +
                ", bailVolume='" + bailVolume + '\'' +
                ", buyFee='" + buyFee + '\'' +
                ", buyFeeStep='" + buyFeeStep + '\'' +
                ", createBy='" + createBy + '\'' +
                ", createDate='" + createDate + '\'' +
                ", dayIncPrice='" + dayIncPrice + '\'' +
                ", disable='" + disable + '\'' +
                ", feeType='" + feeType + '\'' +
                ", unknowId='" + unknowId + '\'' +
                ", pointPrice='" + pointPrice + '\'' +
                ", pointVolume='" + pointVolume + '\'' +
                ", sellFee='" + sellFee + '\'' +
                ", sellFeeStep='" + sellFeeStep + '\'' +
                ", updateBy='" + updateBy + '\'' +
                ", updateDate='" + updateDate + '\'' +
                '}';
    }
}
